package com.indicator.client.bean;

import java.math.BigDecimal;
import java.util.Map;

public final class IndicatorAdapter {

    private final IndicatorComputer computer;
    private final IndicatorManager manager;

    public IndicatorAdapter(IndicatorComputer indicatorComputer, IndicatorManager indicatorManager) {
        this.computer = indicatorComputer;
        this.manager = indicatorManager;
    }

    /**
     * 以后默认值也要动态修改
     *
     * @param key
     * @return
     */
    public BigDecimal compute(String key, Map<String,BigDecimal> map) {
        return compute((key), 24, BigDecimal.ROUND_HALF_UP,map);
    }

    public BigDecimal compute(String key, int prcent, int mode, Map<String,BigDecimal> map) {
        return computer.compute(manager.findIndicator(key), prcent, mode,map);
    }


}
